 package com.farm.resume.service.impl;
 
 import com.farm.core.auth.domain.LoginUser;
 import com.farm.core.sql.query.DataQuery;
 import com.farm.core.time.TimeTool;
 import com.farm.resume.dao.ResumefamilyDaoInter;
 import com.farm.resume.domain.Resumefamily;
 import com.farm.resume.service.ResumefamilyServiceInter;
 import java.util.List;
 import javax.annotation.Resource;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 
 
 
 
 
 
 
 
 
 
 
 @Service
 public class ResumefamilyServiceImpl
   implements ResumefamilyServiceInter
 {
   @Resource
   private ResumefamilyDaoInter resumefamilyDaoImpl;
   private static final Logger log = Logger.getLogger(ResumefamilyServiceImpl.class);
   
   @Transactional
   public Resumefamily insertResumefamilyEntity(Resumefamily entity, LoginUser user)
   {
     entity.setCuser(user.getId());
     entity.setCtime(TimeTool.getTimeDate14());
     entity.setCusername(user.getName());
     entity.setEuser(user.getId());
     entity.setEusername(user.getName());
     entity.setEtime(TimeTool.getTimeDate14());
     entity.setPstate("1");
     return this.resumefamilyDaoImpl.insertEntity(entity);
   }
   
   @Transactional
   public Resumefamily editResumefamilyEntity(Resumefamily entity, LoginUser user)
   {
     Resumefamily entity2 = this.resumefamilyDaoImpl.getEntity(entity.getId());
     entity2.setEuser(user.getId());
     entity2.setEusername(user.getName());
     entity2.setEtime(TimeTool.getTimeDate14());
     entity2.setAddr(entity.getAddr());
     entity2.setWordaddr(entity.getWordaddr());
     entity2.setPhone(entity.getPhone());
     entity2.setZzmm(entity.getZzmm());
     entity2.setBirth(entity.getBirth());
     entity2.setRelationtype(entity.getRelationtype());
     entity2.setName(entity.getName());
     entity2.setUserid(entity.getUserid());
     entity2.setPcontent(entity.getPcontent());
     
 
 
 
 
 
 
 
     this.resumefamilyDaoImpl.editEntity(entity2);
     return entity2;
   }
   
 
   @Transactional
   public void deleteResumefamilyEntity(String id, LoginUser user)
   {
     this.resumefamilyDaoImpl.deleteEntity(this.resumefamilyDaoImpl.getEntity(id));
   }
   
 
   @Transactional
   public Resumefamily getResumefamilyEntity(String id)
   {
     if (id == null) {
       return null;
     }
     return this.resumefamilyDaoImpl.getEntity(id);
   }
   
 
   @Transactional
   public DataQuery createResumefamilySimpleQuery(DataQuery query)
   {
     DataQuery dbQuery = DataQuery.init(query, "FARM_RESUME_FAMILY", 
       "ID,ADDR,WORDADDR,PHONE,ZZMM,BIRTH,RELATIONTYPE,NAME,USERID,PCONTENT,PSTATE,EUSERNAME,EUSER,CUSER,CUSERNAME,ETIME,CTIME");
     return dbQuery;
   }
   
   public ResumefamilyDaoInter getResumefamilyDaoImpl()
   {
     return this.resumefamilyDaoImpl;
   }
   
   public void setResumefamilyDaoImpl(ResumefamilyDaoInter dao) {
     this.resumefamilyDaoImpl = dao;
   }
   
   @Transactional
   public List<Resumefamily> getResumefamilyEntitysByUserId(String userid)
   {
     return this.resumefamilyDaoImpl.getResumefamilyEntitysByUserId(userid);
   }
 }
